package com.tchhy.provider.service.impl

import com.tchhy.provider.data.common.BaseResp
import com.tchhy.provider.data.common.EmptyResp
import com.tchhy.provider.data.common.SmsVO
import com.tchhy.provider.data.partner.response.DataListRes
import com.tchhy.provider.data.profit.response.IncomeBreakdownRes
import com.tchhy.provider.data.profit.response.IncomeRes
import com.tchhy.provider.data.profit.response.SettlementIncomeRes
import com.tchhy.provider.repository.ProfitRepository
import com.tchhy.provider.service.ProfitService
import com.tchyy.provider.data.BindBankInfo
import com.tchyy.provider.data.CashInfo
import com.tchyy.provider.data.CashRecord
import io.reactivex.Observable

/**
 * @author: admin
 * @date: 2019/8/20
 * @des:
 *
 **/
class ProfitServiceImpl : ProfitService {
    private val profitRepository by lazy { ProfitRepository()}

    override fun sendCaptcha(smsVO: SmsVO): Observable<EmptyResp> {
        return profitRepository.sendCaptcha(smsVO)
    }

    override fun bankCardList(): Observable<BaseResp<List<BindBankInfo>>> {
        return profitRepository.bankCardList()
    }

    override fun bindBankCard(bindBankInfo: BindBankInfo): Observable<EmptyResp> {
        return profitRepository.bindBankCard(bindBankInfo)
    }

    override fun unbindBankCard(bankCardId: Long): Observable<EmptyResp> {
        return profitRepository.unbindBankCard(bankCardId)
    }

    override fun cashApply(cashInfo: CashInfo): Observable<BaseResp<Boolean>> {
        return profitRepository.cashApply(cashInfo)
    }

    override fun myIncome(): Observable<BaseResp<IncomeRes>> {
        return profitRepository.myIncome()
    }

    override fun billList(
        pageNum: Int,
        pageSize: Int
    ): Observable<BaseResp<DataListRes<IncomeBreakdownRes>>> {
        return profitRepository.billList(pageNum, pageSize)
    }

    override fun cashRecordList(
        pageNum: Int,
        pageSize: Int
    ): Observable<BaseResp<DataListRes<CashRecord>>> {
        return profitRepository.cashRecordList(pageNum, pageSize)
    }

    override fun settlementDetailsById(settlementId: Long): Observable<BaseResp<IncomeBreakdownRes>> {
        return profitRepository.settlementDetailsById(settlementId)
    }

    override fun detailedListOfBenefits(
        pageNum: Int,
        pageSize: Int,
        startTime: String,
        endTime: String,
        serviceType: Int,
        serviceId: Long
    ): Observable<BaseResp<DataListRes<SettlementIncomeRes>>> {
        return profitRepository.detailedListOfBenefits(pageNum, pageSize, startTime, endTime, serviceType, serviceId)
    }

    override fun incomeBreakdownList(
        pageNum: Int,
        pageSize: Int,
        date: String?,
        type: Int?
    ): Observable<BaseResp<DataListRes<SettlementIncomeRes>>> {
        return profitRepository.incomeBreakdownList(pageNum, pageSize, date, type)
    }
}